package com.itcs.box.server.resolver;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.itcs.box.domain.BoxRequest;
import com.itcs.box.util.LogUtils;

import io.netty.channel.ChannelHandlerContext;

/**
 * 出口车辆白名单主动下发应答
 * 
 * @author LiuPeng
 * @date 2017年12月12日
 * 
 */
@Component
public class Box1005Resolver implements MsgResolverAdapter {

	private Log logger = LogFactory.getLog(getClass());

	@Override
	public boolean support(BoxRequest boxRequest) {
		return "1005".equals(boxRequest.getMessgeType());
	}

	@Override
	public void resolve(ChannelHandlerContext channelHandlerContext, BoxRequest boxRequest) {

		logger.info(LogUtils.build("1005", "出口车辆白名单主动下发应答",
				"通讯盒:" + boxRequest.getData().getDeviceId() + ",流水号:" + boxRequest.getData().getTransacSeq(),
				JSON.toJSONString(boxRequest)));
	}

}
